/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import controll.Mapping;

/**
 * 
 * @author phuc
 */
public class HoaDon implements Serializable {
	private static final long serialVersionUID = 1L;
	private Long hoaDonID;
	private String tenKH;
	private String scmndkh;
	private String diaChi;
	private String sdt;
	private Date thoiGian;
	private Long soTien;
	private NhanVien nhanVienID;
	private List<ChiTietHoaDon> chiTietHoaDonList;
	private Mapping map = null;

	public HoaDon() {
	}

	public HoaDon(Long hoaDonID) {
		this.hoaDonID = hoaDonID;
	}

	public HoaDon(Long hoaDonID, String tenKH, String scmndkh) {
		this.hoaDonID = hoaDonID;
		this.tenKH = tenKH;
		this.scmndkh = scmndkh;
	}

	public Long getHoaDonID() {
		return hoaDonID;
	}

	public void setHoaDonID(Long hoaDonID) {
		this.hoaDonID = hoaDonID;
	}

	public String getTenKH() {
		return tenKH;
	}

	public void setTenKH(String tenKH) {
		this.tenKH = tenKH;
	}

	public String getScmndkh() {
		return scmndkh;
	}

	public void setScmndkh(String scmndkh) {
		this.scmndkh = scmndkh;
	}

	public String getDiaChi() {
		return diaChi;
	}

	public void setDiaChi(String diaChi) {
		this.diaChi = diaChi;
	}

	public String getSdt() {
		return sdt;
	}

	public void setSdt(String sdt) {
		this.sdt = sdt;
	}

	public Date getThoiGian() {
		return thoiGian;
	}

	public void setThoiGian(Date thoiGian) {
		this.thoiGian = thoiGian;
	}

	public Long getSoTien() {
		return soTien;
	}

	public void setSoTien(Long soTien) {
		this.soTien = soTien;
	}

	public NhanVien getNhanVienID() {
		return nhanVienID;
	}

	public void setNhanVienID(NhanVien nhanVienID) {
		this.nhanVienID = nhanVienID;
	}

	/**
	 * Get list chi tiet cac hoa don
	 * @return
	 */
	public List<ChiTietHoaDon> getChiTietHoaDonList() {
		map = new Mapping();
    	return map.getChiTietHoaDonList(this);
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (hoaDonID != null ? hoaDonID.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		// TODO: Warning - this method won't work in the case the id fields are
		// not set
		if (!(object instanceof HoaDon)) {
			return false;
		}
		HoaDon other = (HoaDon) object;
		if ((this.hoaDonID == null && other.hoaDonID != null)
				|| (this.hoaDonID != null && !this.hoaDonID
						.equals(other.hoaDonID))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "entity.HoaDon[ hoaDonID=" + hoaDonID + " ]";
	}

	public HoaDon getHoaDonByID(Long hoaDonID) {
		return map.getHoaDonByID(hoaDonID);
	}

}
